/**
 * 路由配置
 */
import { createRouter, createWebHistory } from 'vue-router'

const routes = [
  {
    path: '/',
    redirect: '/dashboard'
  },
  {
    path: '/dashboard',
    name: 'Dashboard',
    component: () => import('@/views/Dashboard.vue'),
    meta: { title: '数据概览' }
  },
  {
    path: '/salary-analysis',
    name: 'SalaryAnalysis',
    component: () => import('@/views/SalaryAnalysis.vue'),
    meta: { title: '薪资分析' }
  },
  {
    path: '/job-profile',
    name: 'JobProfile',
    component: () => import('@/views/JobProfile.vue'),
    meta: { title: '岗位画像' }
  },
  {
    path: '/ai-assistant',
    name: 'AIAssistant',
    component: () => import('@/views/AIAssistant.vue'),
    meta: { title: 'AI助手' }
  }
]

const router = createRouter({
  history: createWebHistory(),
  routes
})

// 路由守卫：设置页面标题
router.beforeEach((to, from, next) => {
  if (to.meta.title) {
    document.title = `${to.meta.title} - 招聘数据可视化分析系统`
  }
  next()
})

export default router

